package com.egoo.ticket.server.dao;

import com.egoo.ticket.server.pojo.dto.NodeIdAndNameDto;
import com.egoo.ticket.server.pojo.vo.InteractiveDataVo;
import com.egoo.ticket.server.pojo.vo.WorkOrderTypeNodeVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@Component
public interface WorkOrderTypeNodeDao {
	/**
	 * 创建节点
	 * @param workOrderTypeNodeVo
	 * @return
	 */
	Integer create(WorkOrderTypeNodeVo workOrderTypeNodeVo);
	/**
	 * TODO 根据条件获取工单类型节点列表
	 * @author: victor_tang
	 * @createtime: 2020/3/19 17:37
	 * @param searchMap 1
	 * @return: java.util.List<com.egoo.ews.service.vo.WorkOrderTypeNodeVo>
	 */
	List<WorkOrderTypeNodeVo> selectNodeListByCondition(Map<String, Object> searchMap);

	/**
	 * TODO 根据条件获取节点label/Value列表信息
	 * @author: victor_tang
	 * @createtime: 2020/3/19 17:26
	 * @param seachMap 1
	 * @return: java.util.List<com.egoo.ews.service.vo.InteractiveData>
	 */
	List<InteractiveDataVo> selectInteractiveListByCondition(Map<String, Object> seachMap);

	/**
	 * TODO 查询对应节点id的数据
	 * @author: victor_tang
	 * @createtime: 2020/3/19 17:59
	 * @param workOrderNodeId 1
	 * @return: com.egoo.ews.service.vo.InteractiveData
	 */
	InteractiveDataVo selectByWorkOrderNodeId(Long workOrderNodeId);

	/**
	 * TODO 根据工单类型节点id获取节点信息
	 * @param workOrderTypeNodeId
	 * @param tenantId
	 * @return
	 */
	WorkOrderTypeNodeVo selectNodeInfoByWorkOrderNodeId(@Param("workOrderTypeNodeId") Long workOrderTypeNodeId,
                                                        @Param("tenantId") String tenantId);

	/**
	 * /根据工单类型id获取开始节点的信息
	 * @param workOrderTypeId
	 * @return
	 */
	WorkOrderTypeNodeVo selectStartNodeByWorkOrderTypeId(@Param("workOrderTypeId") Long workOrderTypeId);

	/**
	 * /根据工单节点id获取节点的信息
	 * @param workOrderNodeId
	 * @return
	 */
	WorkOrderTypeNodeVo getNodeByWorkOrderNodeId(Long workOrderNodeId);

	/**
	 * 获取转派时的所有可选节点
	 * @param workOrderTypeId
	 * @param workOrderTypeVersion
	 * @return
	 */
	List<NodeIdAndNameDto> getSelectableNodes(@Param("workOrderTypeId") Long workOrderTypeId,
											  @Param("workOrderTypeVersion") Integer workOrderTypeVersion);

	/**
	 * 根据工单类型id删除相关节点node
	 * @param previousId
	 * @return
	 */
	Integer deleteByWorkOrderTypeId(Long previousId);

	/**
	 * TODO 根据状态获取工单类型节点id
	 * @param statusId
	 * @return
	 */
	WorkOrderTypeNodeVo selectWorkOrderTypeNodeInfoByStatuId(@Param("statusId") Integer statusId);

	/**
	 * 动态更新
	 * @param workOrderTypeNodeVo
	 * @return
	 */
	Integer updateByPrimaryKeySelective(WorkOrderTypeNodeVo workOrderTypeNodeVo);

	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	WorkOrderTypeNodeVo selectById(@Param("id") Long id);

	/**
	 * TODO 根据工单类型id获取工单类型最大版本号
	 * @author: victor_tang
	 * @createtime: 2020/4/24 10:53
	 * @param workOrderTypeId 1
	 * @return: com.egoo.ews.service.vo.WorkOrderTypeNodeVo
	 */
	WorkOrderTypeNodeVo selectMaxVersionByWorkOrderTypeId(@Param("workOrderTypeId") Long workOrderTypeId);

	/**
	 * TODO 获取所有节点信息
	 * @author: victor_tang
	 * @createtime: 2020/4/24 13:33
	 * @param
	 * @return: java.util.List<com.egoo.ews.service.vo.WorkOrderTypeNodeVo>
	 */
	List<WorkOrderTypeNodeVo> selectAllNode();

	List<WorkOrderTypeNodeVo> getAllLatestNodes();
}
